<div id="formDiv"></div>
<script type="text/html" id="warehouseProductInventoryDetail">
    <form lay-filter="warehouseProductInventoryDetailFrom" id="warehouseProductInventoryDetailFrom" class="layui-form open-form">
        <div class="open-model">
            <div class="open-auto">

                <table class="layui-table" id="lookDataForm" lay-filter="lookDataForm">
                    <thead>
                    <tr>

                        <th lay-data="{field:'processingType', width:150, sort: true, fixed: 'left'}">
                            货主捆包号
                        </th>
                        <th lay-data="{field:'customerId', width:150, sort: true, fixed: 'left'}">客户规格码
                        </th>
                        <th lay-data="{field:'ownerOrderNumber', width:150, sort: true, fixed: 'left'}">品种名称</th>
                        <th lay-data="{field:'deliveryTime', width:150, sort: true, fixed: 'left'}">牌号</th>
                        <th lay-data="{field:'contractId', width:150, sort: true, fixed: 'left'}">厂家</th>
                        <th lay-data="{field:'contractId', width:150, sort: true, fixed: 'left'}">产品类型</th>
                        <th lay-data="{field:'materialType', width:150, sort: true, fixed: 'left'}">货权客户ID</th>
                        <th lay-data="{field:'totalWeight', width:150, sort: true, fixed: 'left'}">货权入库日期</th>
                        <th lay-data="{field:'totalProcessingFee', width:150, sort: true, fixed: 'left'}">首入库日期</th>
                        <th lay-data="{field:'totalProcessingFee', width:150, sort: true, fixed: 'left'}">净重</th>
                        <th lay-data="{field:'totalProcessingFee', width:150, sort: true, fixed: 'left'}">毛重</th>
                        <th lay-data="{field:'totalProcessingFee', width:150, sort: true, fixed: 'left'}">主单位</th>
                        <th lay-data="{field:'totalProcessingFee', width:150, sort: true, fixed: 'left'}">数量</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td>
                            <input type="text" class="layui-input" name="userBundleCode"/>
                        </td>
                        <td>
                            <input type="text" class="layui-input" name="productSpecCode"/>
                        </td>
                        <td>
                            <input type="text" class="layui-input" name="productVariety"/>
                        </td>
                        <td>
                            <input type="text" class="layui-input" name="productMark"/>
                        </td>
                        <td>
                            <input type="text" class="layui-input" name="productProducer"/>
                        </td>
                        <td>
                            <input type="text" class="layui-input" name="productType"/>
                        </td>
                        <td>
                            <input type="text" class="layui-input" name="buyerCustomerId"/>
                        </td>
                        <td>
                            <input type="text" class="layui-input" name="customerInboundDate"/>
                        </td>
                        <td>
                            <input type="text" class="layui-input" name="firstEntryDate"/>
                        </td>
                        <td>
                            <input type="text" class="layui-input" name="netWeight"/>
                        </td>
                        <td>
                            <input type="text" class="layui-input" name="grossWeight"/>
                        </td>
                        <td>
                            <input type="text" class="layui-input" name="productMainUnit"/>
                        </td>
                        <td>
                            <input type="text" class="layui-input" name="quantity"/>
                        </td>
                    </tr>
                    </tbody>
                </table>

                <div class="layui-form-item tableContent" id="form">
                    <label class="layui-form-label" style="text-align: left;width: 140px">生命周期记录：</label>
                    <table class="layui-table" lay-filter="lookDataForm">
                        <thead>
                        <tr>
                            <th lay-data="{field:'processingType', width:150, sort: true, fixed: 'left'}">
                                业务性质
                            </th>
                            <th lay-data="{field:'customerId', width:150, sort: true, fixed: 'left'}">描述
                            </th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>客户发货</td>
                            <td id="shipmentList"> </td>
                        </tr>
                        <tr>
                            <td>签收</td>
                            <td id="signList"> </td>
                        </tr>
                        <tr>
                            <td>移库</td>
                            <td id="moveList"></td>
                        </tr>
                        <tr>
                            <td>过户</td>
                            <td id="transferList"> </td>
                        </tr>
                        <tr>
                            <td>出库</td>
                            <td id="outboundList"> </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <div class="layui-form-item text-right">
                    <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">关闭</button>
                </div>
            </div>
        </div>
    </form>
</script>
<script id="shipmentList1" type="text/html">
{{#  layui.each(d.shipmentList, function(index, item){ }}
    <p>发货记录ID：{{ item.shipment_order_code ||'无'}}</p>
    <p>时间：{{ item.create_time ||'无'}}</p>
    <p>发货人：{{ item.creator_name ||'无'}}</p>
    <p>来源：{{ item.source=='2'?'客户端':'后台添加'||'无' }}</p>
    <p>运单号：{{ item.source ||'无'}}</p>
{{#  }); }}
{{#  if(d.shipmentList.length === 0){ }}
无数据
{{#  } }}
</script>
<script id="signList1" type="text/html">
    {{#  layui.each(d.signList, function(index, item){ }}
    <p>签收记录ID：{{ item.sign_code ||'无'}}</p>
    <p>时间：{{ item.create_time||'无' }}</p>
    <p>签收人：{{ item.creator_name||'无' }}</p>
    <p>存放库位：{{ item.code ||'无'}}</p>
    {{#  }); }}
    {{#  if(d.signList.length === 0){ }}
    无数据
    {{#  } }}
</script>
<script id="moveList1" type="text/html">
    {{#  layui.each(d.moveList, function(index, item){ }}
    <p>移库记录ID：{{ item.id ||'无'}}</p>
    <p>时间：{{ item.create_time ||'无'}}</p>
    <p>操作人：{{ item.creator_name||'无' }}</p>
    <p>原库位：{{ item.warehouseShelfSpaceCode ||'无'}}</p>
    <p>移动后库位：{{ item.nowWarehouseShelfSpaceCode ||'无'}}</p>
    {{#  }); }}
    {{#  if(d.moveList.length === 0){ }}
    无数据
    {{#  } }}
</script>
<script id="transferList1" type="text/html">
    {{#  layui.each(d.transferList, function(index, item){ }}
    <p>过户记录ID：{{ item.transfer_code ||'无'}}</p>
    <p>时间：{{ item.create_time||'无' }}</p>
    <p>操作人：{{ item.creator ||'无'}}</p>
    <p>原货主：{{ item.seller_customer||'无' }}</p>
    <p>货主：{{ item.buyer_customer||'无' }}</p>
    {{#  }); }}
    {{#  if(d.transferList.length === 0){ }}
    无数据
    {{#  } }}
</script>
<script id="outboundList1" type="text/html">
    {{#  layui.each(d.outboundList, function(index, item){ }}
    <p>出库记录ID：{{ item.warehouse_outbound_order_code ||'无'}}</p>
    <p>时间：{{ item.create_time||'无' }}</p>
    <p>出库类型：{{ item.name||'无' }}</p>
    <p>操作人：{{ item.creator ||'无'}}</p>
    <p>出库库位：{{ item.warehouseShelfSpaceCode ||'无'}}</p>
    {{#  }); }}
    {{#  if(d.outboundList.length === 0){ }}
    无数据
    {{#  } }}
</script>
<script>
    layui.use(["layer", "form", "table", "admin", "laydate", "upload", "laytpl"], async function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var config = layui.config;
        var admin = layui.admin;
        var upload = layui.upload;
        let laydate = layui.laydate;
        let laytpl = layui.laytpl;
        const nowData = { ...parentData };
        let data = nowData?.data;
        let customerId;
        let bundleCodeCounter = 1;
        try {
            if (!data.status) {
                nowData.status = 0
            } else {
                nowData.status = data.status
            }
        } catch (e) {
            nowData.status = 0
        }


        laytpl(warehouseProductInventoryDetail.innerHTML).render({ ...nowData }, function (html) {
            $("#formDiv").after(html);
        });


        if(data&&data.id){
            form.val("warehouseProductInventoryDetailFrom", data);
            var shipmentListHtml = shipmentList1.innerHTML
                ,shipmentList = document.getElementById('shipmentList')
                ,signListHtml = signList1.innerHTML
                ,signList = document.getElementById('signList')
                ,moveListHtml = moveList1.innerHTML
                ,moveList = document.getElementById('moveList')
                ,transferListHtml = transferList1.innerHTML
                ,transferList = document.getElementById('transferList')
                ,outboundListHtml = outboundList1.innerHTML
                ,outboundList = document.getElementById('outboundList')
            laytpl(shipmentListHtml).render(data, function(html){
                shipmentList.innerHTML = html;//客户发货
            });
            laytpl(signListHtml).render(data, function(html){
                signList.innerHTML = html;//签收
            });
            laytpl(moveListHtml).render(data, function(html){
                moveList.innerHTML = html;//移库
            });
            laytpl(transferListHtml).render(data, function(html){
                transferList.innerHTML = html;//过户
            });
            laytpl(outboundListHtml).render(data, function(html){
                outboundList.innerHTML = html;//出库
            });
        }

        admin.setFormDisable("#warehouseProductInventoryDetailFrom", true);

        $("#warehouseProductInventoryDetailFrom .layui-table-body").css("overflow", "visible");
        $("#warehouseProductInventoryDetailFrom .layui-table-box").css("overflow", "visible");
        $("#warehouseProductInventoryDetailFrom .layui-table-view").css("overflow", "visible");
    });
</script>

<style>

    #warehouseProductInventoryDetailFrom .layui-form-label {
        width: 125px;
    }

    #warehouseProductInventoryDetailFrom .layui-input-block {
        margin-left: 155px;
    }

    #warehouseProductInventoryDetailFrom .layui-form-item .layui-inline {
        /* margin-bottom: 5px; */
        margin-right: 0px;
    }

    #warehouseProductInventoryDetailFrom .layui-table-cell {
        overflow: visible !important;
    }

    #table .layui-table-box {
        overflow: hidden !important;
    }

    #table .layui-table-body {
        overflow: auto !important;
    }
    #table .layui-table-view .layui-table td, .layui-table-view .layui-table th{
        overflow: hidden;
    }
    #form .layui-table-cell {
        padding: 0 6px;
    }
</style>